<?php

//sharing requires a source user, a targer user, an object type, and object identifier, and a destination to go to on completion

@session_start();
$access_token = $_SESSION['access_token'];

	$suser = $access_token['user_id'];

	$type = $_REQUEST['type'];
	$typeid = $_REQUEST['typeid'];
	$redirect = $_REQUEST['redirect'];

// now I need to display the followers of this user, 
?>
<h1>Share <?php echo $typeid; ?> with:</h1>
<form method="post" action="_share.php">
<input type="hidden" name="redirect" value = "<?php echo $redirect; ?>" />
<input type="hidden" name="suser" value = "<?php echo $suser; ?>" />
<input type="hidden" name="type" value = "<?php echo $type; ?>" />
<input type="hidden" name="typeid" value = "<?php echo $typeid; ?>" />
<?php
	$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);

	//need to get followers
	$jsonDecode = $connection->get('statuses/followers');
	foreach ($jsonDecode as $timelineEntry)
	{
?>
<input type="image" id="shareimage" name="tuser" title="Click to share <?php echo $typeid; ?> with <?php echo $timelineEntry->screen_name; ?>" value = "<?php echo $timelineEntry->id; ?>" src = "<?php echo $timelineEntry->profile_image_url; ?>" />
<?php
	}
?>
</form>